<%@ page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改有效时间</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/common/bootstrap/css/bootstrap.css"
          media="all">
    <script type="text/javascript" src="${pageContext.request.contextPath}/common/bootstrap/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/common/bootstrap/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/common/bootstrap/js/jquery.cookie.js" type="text/javascript"
            charset="utf-8"></script>
</head>
<body>
<div class="container">
    <div class="col-sm-12" style="margin-bottom: 50px;">
        <h3 style="text-align: center;"><b>修改有效时间</b></h3>
    </div>
    <div class="col-sm-6">
        <c:set value="${clinicalDataQuery}" var="CDQ"/>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">查询条件名称：</label>
            <div class="col-sm-6">
                <input class="form-control" value="${CDQ.queryConditions}" readonly/>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">联系方式：</label>
            <div class="col-sm-6">
                <input class="form-control" value="${CDQ.contact}" readonly/>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">申请时间：</label>
            <div class="col-sm-6">
                <fmt:formatDate value="${CDQ.stateTime}" var="statetime" pattern="yyyy-MM-dd HH:mm:ss"/>
                <input class="form-control" value="${statetime}" readonly/>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">审批状态：</label>
            <div class="col-sm-6">
                <input class="form-control" value="${CDQ.approverState==1?'审批中':'待审批' }" readonly/>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">申请理由：</label>
            <div class="col-sm-6">
                <textarea class="form-control" readonly style="height: 200px;"/> ${CDQ.applyReason} </textarea>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">原本的有效时间：</label>
            <div class="col-sm-6">
                <fmt:formatDate value="${CDQ.endTime}" var="endtime" pattern="yyyy-MM-dd"/>
                <input class="form-control" value="${endtime}" readonly/>
                <input class="form-control" value="${CDQ.queryConditionsId}" type="hidden" id="queryConditionsId"
                       readonly/>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-4 control-label" style="text-align: right; line-height: 35px;">
                修改的有效时间：
                <i style="color: red;">*</i>
            </label>
            <div class="col-sm-6">
                <input type="date" id="updateEndtime" class="form-control"/>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <label class="col-sm-2 control-label" style="text-align: right; line-height: 35px;"></label>
            <div class="col-sm-2">
                <button class="btn btn-primary" id="btn_update">保存</button>
            </div>
            <div class="col-sm-2">
                <a href="clinicalDataQueryDisplay.jsp">
                    <button class="btn btn-primary">返回</button>
                </a>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $("#btn_update").click(function () {
            var queryConditionsId = $("#queryConditionsId").val()
            var updateEndtime = $("#updateEndtime").val()
            console.log(queryConditionsId)
            console.log(updateEndtime)
            $.ajax({
                url: "../../ClinicalDataQuery/updateByEndTime",
                data: "queryConditionsId=" + queryConditionsId + "&updateEndtime=" + updateEndtime,
                type: "POST",
                dataType: "json",
                success: function (map) {
                    window.location.href = "clinicalDataQueryDisplay.jsp";
                }
            })
        })
    })
</script>
</body>
</html>